﻿namespace PhoneApp._0930._1;

public class Demo
{
    public void TestPrint1()
    {
        Console.WriteLine("请输入三个数");
        string[] inputParts = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        
        int x = int.Parse(inputParts[0]);
        int y = int.Parse(inputParts[1]);
        int z = int.Parse(inputParts[2]);
        int temp;
        if (x > y)
        {
            temp = x;
            x = y;
            y = temp;
        }
        if (x > z)
        {
            temp = x;
            x = z;
            z = temp;
        }
        if (y > z)
        {
            temp = y;
            y = z;
            z = temp;
        }
        Console.WriteLine("从小到大排序结果：" + x + " " + y + " " + z);
    }
    
    public void TestPrint2()
    {
        int a = 0;
        int c = 0;
        int[] numbers = new int[] { };
        for (int i = 0; i <= 100; i++)
        {
            if ((i / 7 == 0) || (i % 10 == 7) || (i / 10 == 7) || (i == 7))
            {
                Console.WriteLine(i);
                numbers[a] = i;
                a++;
            }
        }

        for (int b = 0; b <= a; b++)
        {
            c = c + numbers[b];
        }

        Console.WriteLine("数字和为");
        Console.WriteLine(c);
    }


   public  void TestPrint3()
    {
        for (int i = 0; i <= 9; i++)
        {
            for (int j = 0; j <= 9; j++)
            {
                Console.Write(i + "*" + j + "=" + i * j + "\t");
            }
            Console.WriteLine();
        }
    }

   public  void TestPrint4()
    {
        for (int i = 0; i <= 1000; i++)
        {
            int[] number =  new int[500]; ;
            for (int j = 0; j <= i / 2; j++)
            {
                if (i % j == 0)
                {
                    number[j] = j;
                }
            }
        }
    }

   public  void TestPrint5()
    {
        Console.WriteLine("请输入一个正整数：");
        if (int.TryParse(Console.ReadLine(), out int number) && number > 0)
        {
            int temp = number;
            int digitCount = 0;
            string reverse = "";
            while (temp > 0)
            {
                int digit = temp % 10; 
                reverse += digit + " ";
                temp /= 10;
                digitCount++;
            }
            
            Console.WriteLine($"该数字是 {digitCount} 位数");
            Console.WriteLine("逆序打印各位数字：" + reverse);
        }
        else
        {
            Console.WriteLine("输入无效，请确保输入的是正整数");
        }
    }

    public void TestPrint6()
    {
        
    }
    }

